home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / examples.arc / EXAMPL45.PRO < prev    next >
Text File  |  1986-10-07  |  767b  |  35 lines

  1. /* Program 45 */
  2. /*
  3.   This program dumps a file to your screen.
  4.   Enter a file name, like EXAMPL44.PRO.
  5.  
  6.   To make this program deterministic, two cuts 
  7.   have been added to the print_contents 
  8.   predicate.
  9. */
  10.  
  11. domains
  12.     file = input
  13.  
  14. predicates
  15.     start
  16.     print_contents
  17.  
  18. goal
  19.     start.
  20.  
  21. clauses
  22.     start:-
  23.         clearwindow,
  24.         write("which file do you want to \nwork with ? "),
  25.         readln(FileName),
  26.         openread(input,FileName),
  27.         readdevice(input),
  28.         print_contents.
  29.     print_contents:-!,
  30.         not(eof(input)),readchar(Y),char_int(Y,T),
  31.         write(T," "),print_contents.
  32.     print_contents:-!,
  33.         nl,readdevice(keyboard),
  34.         write("\nPlease press the space bar"),readchar(_).
  35.